import * as ActionTypes from '../action-types'
import { AnyAction, Dispatch } from "redux";
import { getPartitionsRequest } from '@/api/partitions';

export const setPartitions = (data: any[]) => ({
    type: ActionTypes.SET_PARTITIONS,
    data
})

export const getPartitions = (): any => {
    return (dispatch: Dispatch<AnyAction>) => {
        getPartitionsRequest()
            .then(data => {
                // console.log(data);
                dispatch(setPartitions(data))
            })
    }
}